<div class="layui-body-header">
	<h2>会员列表</h2>
</div>

<div class="layui-card-body">
	<div class="layui-fluid">
		<div class="layui-card">
          <div class="layui-card-header">
            <!-- <span>所有会员列表</span> -->
            <button type="button" class="layui-btn layui-btn-sm layui-btn-primary changeInte">
              <i class="layui-icon">&#xe673;</i>
              <span>变更等级积分</span>
            </button>
            <!--<button type="button" class="layui-btn layui-btn-sm layui-btn-primary check">
              <i class="layui-icon">&#xe63c;</i>
              <span>考勤</span>
            </button>-->
            <button type="button" class="layui-btn layui-btn-sm layui-btn-danger batchDel">
              <i class="layui-icon">&#xe640;</i>
              <span>批量删除</span>
            </button> 
            <button type="button" class="layui-btn layui-btn-sm addMoney">
              <i class="layui-icon">&#xe735;</i>
              <span>续费</span>
            </button> 
            <button type="button" class="layui-btn layui-btn-sm layui-btn-primary addTuiJian">
              <i class="layui-icon">&#xe654;</i>
              <span>添加推荐</span>
            </button> 
            <button type="button" class="layui-btn layui-btn-sm layui-btn-primary cancelTuiJian">
              <i class="layui-icon">&#xe640;</i>
              <span>取消推荐</span>
            </button> 
            <!--<a href="#/layui/ediMember" type="button" class="layui-btn layui-btn-sm">
              <i class="layui-icon">&#xe654;</i>
              <span>添加会员</span>
            </a>-->
            <!--<a href="#/member/all/edit" class="layui-btn layui-btn-sm layui-btn-primary">
              <i class="layui-icon">&#xe62f;</i>
              <span>导出到Excel</span>
            </a>-->
            <a href="javascript:;" class="layui-btn layui-btn-sm layui-btn-primary" id="search_hash">
              <i class="layui-icon">&#xe615;</i>
            </a>
          </div>
          <div class="layui-card-body">
            <table id="memberListTable" lay-filter="test"></table>
            <script type="text/html" id="barDemo_hash">
            	<!--<a class="layui-btn layui-btn-xs layui-btn-primary" lay-event="changeScore">变更等级积分</a>-->
              <a class="layui-btn layui-btn-xs" lay-event="detail">编辑</a>	
              <!-- <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a> -->
              <!--<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>-->
            </script>
          </div>
        </div>
      </div>
    </div>
      
      

<script type="text/html" id="search_tpl_hash">
  <form class="layui-form" action="">
    <!--<div class="layui-form-item">
      <label class="layui-form-label">会员ID</label>
      <div class="layui-input-block">
        <input type="text" name="memId" id="memId" placeholder="" autocomplete="off" class="layui-input">
      </div>
    </div>-->
    <div class="layui-form-item">
      <label class="layui-form-label">会员姓名</label>
      <div class="layui-input-block">
        <input type="text" name="memName" id="memName" placeholder="" autocomplete="off" class="layui-input">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">联系电话</label>
      <div class="layui-input-block">
        <input type="text" name="tel" id="tel" placeholder="" autocomplete="off" class="layui-input">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">会员等级</label>
      <div class="layui-input-block">
        <select name="memLev" id="memLev" class="memLev">
          <option value="">全部</option>
        </select>
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">行业</label>
      <div class="layui-input-block">
      	<table class="layui-table " lay-skin="nob">
      		<tr>
      			<td>
      				<select name="yiji" id="yiji" class="yiji" lay-filter="yiji">
			          <option value="">一级行业</option>
			        </select>
      			</td>
      			<td>
      				<select name="erji" id="erji" class="erji" lay-filter="erji">
			          <option value="">二级行业</option>
			        </select>
      			</td>
      		</tr>
      	</table>
        
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">所属分会</label>
      <div class="layui-input-block">
        <input type="text" name="fenhui" id="fenhui" placeholder="" autocomplete="off" class="layui-input">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">公司</label>
      <div class="layui-input-block">
        <input type="text" name="gongsi" id="gongsi" placeholder="" autocomplete="off" class="layui-input">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">主营业务</label>
      <div class="layui-input-block">
        <input type="text" name="yewu" id="yewu" placeholder="" autocomplete="off" class="layui-input">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">分享资源</label>
      <div class="layui-input-block">
        <input type="text" name="fenxiang" id="fenxiang" placeholder="" autocomplete="off" class="layui-input">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">供求资源</label>
      <div class="layui-input-block">
        <input type="text" name="gongqiu" id="gongqiu" placeholder="" autocomplete="off" class="layui-input">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">地区</label>
      <div class="layui-input-block">
        <table class="layui-table fenhuiArea" lay-skin="nob">
			<tbody>
				<tr>
					<td>
						<select name="province" class="province" lay-verify="" lay-filter="provinces"> 
								  <option value="">省份</option>
								</select> 
					</td>
					<td>
						<select name="city" class="city" lay-verify="" lay-filter="citys">
						  <option value="">城市</option>
						</select> 
					</td>
					<td>
						<select name="Area" class="Area" id="quyu" lay-verify="" lay-filter="Areas">
						  <option value="">区域</option>
						</select> 
					</td>
				</tr>
			</tbody>
		</table>
      </div>
      
    </div>
    <div class="layui-form-item">
      <div class="layui-input-block">
        <button class="layui-btn" lay-submit lay-filter="formDemo_hash"><i class="layui-icon">&#xe615;</i> 搜索</button>
        <button type="reset" id="resets" class="layui-btn layui-btn-primary">重置</button>
      </div>
    </div>
  </form>
</script>

<!--头部工具栏-->
<script type="text/html" id="toolbarDemo">
</script>
<script type="text/javascript" src="../../api/DBHelper.js"></script>
<script>
	let delAll = document.querySelector(".delAll");
	let changeInte = document.querySelector(".changeInte");
	let checked = '';
	let thisObj='';
	let editMem = document.querySelector(".editMem");
	let batchDel = document.querySelector(".batchDel");
	let addMoney = document.querySelector(".addMoney");
	let addTuiJian = document.querySelector(".addTuiJian");
	let cancelTuiJian = document.querySelector(".cancelTuiJian");
	let check = document.querySelector(".check");
	let checkedArr = [];
	let objArr = [];	
	
	
  layui.use(['jquery', 'mockjs', 'table', 'sidebar', 'form' ,'route'], function () {
    var $ = layui.jquery,
      layer = layui.layer,
      table = layui.table,
      sidebar = layui.sidebar,
      route = layui.route,
      params = route.params(),
      form = layui.form;
      var types = "";
      console.log("params",params)
      if(params!=null){
      	types = params.type;
      }else
      
      
    // 注入mock
    layui.mockjs.inject({
      'POST /demo/table/user': {
        code: 0,
        msg: "xxx",
        count: 1000,
        'data|20': [{
          'id|+1': 1,
          username: '@name',
          sex: '@boolean',
          city: '@city',
          sign: '@csentence',
          experience: '@integer',
          score: '@integer',
          classify: '@word',
          wealth: '@integer',
          auth: '@boolean'
        }]
      }
    });
    //第一个实例
    table.render({
      method: 'post',
      // size: 'sm',
      limit: 10,
      limits: [10,20,30],
      elem: '#memberListTable',
      id:'test',
      toolbar: '#toolbarDemo',
      height: 'full-235',
      url: 'https://xnsmb.xnsoft.net.cn/api/Filtrate_Xn_Member', //数据接口
      page: true, //开启分页
      contentType: 'application/json',
      where: {
      	"MemLoginId": "",
			  "RealName": "",
			  "Mobile": "",
			  "RankGuid": "",
			  "FiltrateTimeType": types
      },
      parseData: function(res){
      	return {
      		'code':0,
      		'count':res.TotalCount,
      		"data":res._Data
      	};
      },
      done:function(res,curr,count){
      	hoverOpenImg();
      },
      request: {
		    pageName: 'CurrentPage' //页码的参数名称，默认：page
		    ,limitName: 'PageSize' //每页数据量的参数名，默认：limit
		  },
      cols: [
        [ //表头
          {
//          width: 150,
            fixed: 'left',
            align: 'center',
            type: 'checkbox'
          },{
            field: 'Images',
            title: '会员头像',
            align: 'center',
            templet:'<div><img src="{{ d.MinPhoto}}" style="width:25px;height:25px"></div>',
//          width: 200
          }, 
//        {
//          field: 'MemLoginId',
//          align: 'center',
//          title: '会员ID',
////          width: 150
//        }, 
          {
            field: 'RealName',
            align: 'center',
            title: '会员姓名',
//          width: 150
          },{
            field: 'NickName',
            align: 'center',
            title: '会员昵称',
//          width: 150FatherName
          }, {
            field: 'FatherName',
            align: 'center',
            title: '推荐人',
//          width: 150FatherName
          },{
            field: 'Mobile',
            align: 'center',
            title: '手机号',
//          width: 150
          }, 
          {
            field: 'ValidityDate',
            align: 'center',
            title: '会员有效期',
//          width: 150
          }, 
          {
            field: 'CreateTime',
            align: 'center',
            title: '注册日期',
//          width: 150
          }, 
          {
            field: 'CircleName',
            align: 'center',
            title: '所属分会',
//          width: 150
          }, 
          {
            field: 'Area',
            align: 'center',
            title: '所属城市',
//          width: 150
          }, 
          {
            field: 'RecommentCount',
            align: 'center',
            title: '推荐人数累计',
//          width: 150
          }, 
//        {
//          field: '',
//          title: '职位',
////          width: 150
//        },{
//          field: '',
//          title: '行业',
////          width: 150
//        },
//        {
//          field: 'LikeCount',
//          align: 'center',
//          title: '点赞数量',
//          sort: true
////          width: 150
//        },{
//          field: 'BrowseCount',
//          align: 'center',
//          title: '人气数量',
//          sort: true
////          width: 150
//        },{
//          field: 'CollectCount',
//          align: 'center',
//          title: '收藏数量',
//          sort: true
////          width: 150
//        },{
//          field: 'TransmitCount',
//          align: 'center',
//          title: '转发数量',
//          sort: true
////          width: 150
//        },
          {
            field: 'IsRecommend',
            align: 'center',
            title: '是否推荐',
            sort: true,
            templet:function(d){
            	if(d.IsRecommend==0){
            		return '<span>否</span>'
            	}else if(d.IsRecommend==1){
            		return '<span>是</span>'
            	}else if(d.IsRecommend==null){
            		return ''
            	}
            }
//          width: 150
          },{
            fixed: 'right',
//          width: 230,
            align: 'center',
            toolbar: '#barDemo_hash'
          }
        ]
      ]
    });

    $('#search_hash').on('click', function () {
      var that = this;
      // console.log($('#search_tpl_hash').html());
      sidebar.render({
        elem: that,
        content: $('#search_tpl_hash').html(),
        title: '搜索',
        shade: true,
        // shadeClose:false,
        // direction: 'left'
        // dynamicRender: false,
        // url: 'views/member/all/search.html',
        width: '500px', //可以设置百分比和px
        done: function () {
        	let province = document.querySelector(".province");
        	let city = document.querySelector(".city");
        	let Areas = document.querySelector(".Area");
        	let memLev = document.querySelector(".memLev");
        	let re = document.querySelector(".reset");
        	let ciArr = [];
        	let proArr = [];
        	let yijiArr = [];
        	let erjiArr = [];
        	let code = '';
        	let hangyeId = '';
        	let yijihangyeId = '';
        	let areaCode = '';
//      	let memLev = document.querySelector(".memLev");
          console.log('ccc',memLev);
//        form.render();

		
          
          DBHelper.Get("GetXn_RankByCategoryId?id=0",function(data){
          	console.log(data)
          	
          	data.forEach((el,index)=>{
//		    		  	let op = document.createElement('option');
//		    		  	op.value = el.Guid;
//		    		  	op.innerText = el.Name;
//		    		  	memLev.appendChild(op)
		    		  	$("#memLev").append("<option value='"+el.Guid+"'>"+el.Name+"</option>");
		    		  })
//        	for(let i = 0 ; i < data.length ; i++){
////        		var op = document.createElement('option');
////        		op.value = data[i].Guid
////        		op.innerText = data[i].Name;
////        		memLev.appendChild(op)
//        		$(memLev).append('<option value="'+data[i].Guid+'">'+data[i].Name+'</option>')
//        		
//        	}
          	form.render();
          	
          	$("#resets").click(function(){
          	console.log(1)
          	areaCode = '';
          	memLevCode = '';
          	code = '';
          	hangyeId = '';
          })
          
			
          	
          },function(data){
          	console.log(data)
          })
//        $(memLev).append('<option value="1">2</option>')
          	form.render();
          	
//        	一级行业
          	$.ajax({//异步请求返回给后台
		    	  url:'https://xnsmb.xnsoft.net.cn/api/GetXn_Trade?FatherId=00',
		    	  type:'get',
		    	  data:{},
		    	  dataType:'json',
		    	  beforeSend: function(request) {
			            
			            request.setRequestHeader("Authorization", 'bearer ' + localStorage.getItem("token"));
			        },
		    	  success:function(data){
		    		  //这里获取到数据执行显示
		    		  yijiArr = [...data];
//		    		  console.log("地址data",data)
							let p = document.createElement('option');
							p.value='';
							p.innerText="一级行业";
		    		  data.forEach((el,index)=>{
//		    		  	let op = document.createElement('option');
//		    		  	op.value = el.ID;
//		    		  	op.innerText = el.Name;
//		    		  	province.appendChild(op)
		    		  	$(".yiji").append("<option value='"+el.Id+"'>"+el.Name+"</option>");
		    		  	
		    		  })
		    		  renderForm();
					


					console.log(1,data)
		    	  }
		    	  
		      });
		      
//		      获取一级行业的Code
		      form.on('select(yiji)',function(data){
		      	$(".erji").empty();
		      	console.log(data.value)
		      	code = data.value;
		      	
		      	yijiArr.forEach((el,index)=>{
      				if(el.Id==data.value){
      					code=el.Code;
      					hangyeId=el.Code;
      					yijihangyeId=el.Code;
      					console.log(9,hangyeId)
      					
      				}
      			})
      			if(data.value==""){
      				code="";
      				hangyeId="";
      			}
      			
//    			二级行业
      			$.ajax({//异步请求返回给后台
					    	  url:'https://xnsmb.xnsoft.net.cn/api/GetXn_Trade',
					    	  type:'get',
					    	  data:{FatherId:code},
					    	  dataType:'json',
					    	  beforeSend: function(request) {
			            
			            request.setRequestHeader("Authorization", 'bearer ' + localStorage.getItem("token"));
			        },
					    	  success:function(data){
					    	  	erjiArr = [...data];
					    		  //这里获取到数据执行显示
					    		  console.log(data)
			//		    		  console.log("secJobs",secJobs.length)
			//							secJobs="";
//										$(".city").empty();
//										let p = document.createElement('option');
//										p.value = "";
//										p.innerText = "城市";
//										city.appendChild(p)
										$(".erji").append("<option value=''>二级行业</option>");
					    		  data.forEach((el,index)=>{
//					    		  	let op = document.createElement('option');
//					    		  	op.value = el.ID;
//					    		  	op.innerText = el.Name;
//			//		    		  	op.id = el.Id;
//					    		  	city.appendChild(op)
					    		  	$(".erji").append("<option value='"+el.Code+"'>"+el.Name+"</option>");
					    		  })
					    		  renderForm();
					    		  
					    	  }
					    	  
					      });
		      })
		      
//		      选择二级行业
			form.on('select(erji)', function(data){
				if(data.value==""){
					hangyeId=yijihangyeId;
					console.log(5,hangyeId)
				}else{
					let _erji = data.value;
						console.log(6,data.value)
						hangyeId = data.value;
						console.log(5,hangyeId)
				}
						
		    		})
          	
          	
          	$.ajax({//异步请求返回给后台
		    	  url:'https://xnsmb.xnsoft.net.cn/api/GetXn_DispatchRegion',
		    	  type:'get',
		    	  data:{FatherId:'0'},
		    	  dataType:'json',
		    	  beforeSend: function(request) {
			            
			            request.setRequestHeader("Authorization", 'bearer ' + localStorage.getItem("token"));
			        },
		    	  success:function(data){
		    		  //这里获取到数据执行显示
		    		  proArr = [...data];
//		    		  console.log("地址data",data)
							let p = document.createElement('option');
							p.value='';
							p.innerText="省份";
		    		  data.forEach((el,index)=>{
//		    		  	let op = document.createElement('option');
//		    		  	op.value = el.ID;
//		    		  	op.innerText = el.Name;
//		    		  	province.appendChild(op)
		    		  	$(".province").append("<option value='"+el.ID+"'>"+el.Name+"</option>");
		    		  	
		    		  })
		    		  renderForm();
		    	  }
		    	  
		      });
		      
		      form.on('select(provinces)', function(data){
		      	$(".city").empty();
		      	console.log("data.value",data.value)
		      			proArr.forEach((el,index)=>{
		      				if(el.ID==data.value){
		      					areaCode=el.Code;
		      				}
		      			})
		      			if(data.value==""){
		      				areaCode="";
		      			}
		      			console.log("areaCode",areaCode);
						cityCode = data;
			//			console.log("seFrist",seFrist)
//					  console.log(data.value);
					  $.ajax({//异步请求返回给后台
					    	  url:'https://xnsmb.xnsoft.net.cn/api/GetXn_DispatchRegion',
					    	  type:'get',
					    	  data:{FatherId:data.value},
					    	  dataType:'json',
					    	  beforeSend: function(request) {
			            
			            request.setRequestHeader("Authorization", 'bearer ' + localStorage.getItem("token"));
			        },
					    	  success:function(data){
					    	  	ciArr = [...data];
					    		  //这里获取到数据执行显示
					    		  console.log(data)
			//		    		  console.log("secJobs",secJobs.length)
			//							secJobs="";
//										$(".city").empty();
//										let p = document.createElement('option');
//										p.value = "";
//										p.innerText = "城市";
//										city.appendChild(p)
										$(".city").append("<option value=''>城市</option>");
					    		  data.forEach((el,index)=>{
//					    		  	let op = document.createElement('option');
//					    		  	op.value = el.ID;
//					    		  	op.innerText = el.Name;
//			//		    		  	op.id = el.Id;
//					    		  	city.appendChild(op)
					    		  	$(".city").append("<option value='"+el.ID+"'>"+el.Name+"</option>");
					    		  })
					    		  renderForm();
					    		  
					    	  }
					    	  
					      });
					});   
					
					form.on('select(citys)', function(data){
						$(".Area").empty();
						let _city = data.value;
						if(data.value==""){
	      				areaCode=areaCode.substr(0,3);
	      			}
//						AreaCode = data;
			//			console.log("seFrist",seFrist)
//					  console.log(data.value);
					  $.ajax({//异步请求返回给后台
					    	  url:'https://xnsmb.xnsoft.net.cn/api/GetXn_DispatchRegion',
					    	  type:'get',
					    	  data:{FatherId:data.value},
					    	  dataType:'json',
					    	  beforeSend: function(request) {
			            
			            request.setRequestHeader("Authorization", 'bearer ' + localStorage.getItem("token"));
			        },
					    	  success:function(data){
					    	  	
					    		  //这里获取到数据执行显示
					    		   console.log(data)
//					    		  console.log("ciArr",ciArr)
					    		  ciArr.forEach((el,index)=>{
					    		  	if(el.ID==_city){
					    		  		areaCode=el.Code
					    		  	}
					    		  })
					    		  
					    		  console.log(data)
			//		    		  console.log("secJobs",secJobs.length)
			//							secJobs="";
//										$(".Area").empty();
//										let p = document.createElement('option');
//										p.value = "";
//										p.innerText = "区域";
//										Areas.appendChild(p)
										$(".Area").append("<option value=''>区域</option>");
					    		  data.forEach((el,index)=>{
//					    		  	let op = document.createElement('option');
//					    		  	op.value = el.Code;
//					    		  	op.innerText = el.Name;
//			//		    		  	op.id = el.Id;
//					    		  	Areas.appendChild(op)
					    		  	$(".Area").append("<option value='"+el.Code+"'>"+el.Name+"</option>");
					    		  })
					    		  renderForm();
					    		  
					    	  }
					    	  
					      });
					}); 
					
					form.on('select(Areas)', function(data){
						if(data.value!=""){
							areaCode = $("#quyu option:selected").val();
//							areas = $(".province option:selected").text()+$(".city option:selected").text()+$(".Area option:selected").text();
						}else{
							areaCode=areaCode.substr(0,6);
						}
						
						
						console.log("areaCode",areaCode);
//						console.log("areas",areas)
					})
					
					form.render();
					
					function renderForm(){
		  layui.use('form', function(){
		   var form = layui.form;//高版本建议把括号去掉，有的低版本，需要加()
		   form.render();
		  });
		}

          //监听提交
          form.on('submit(formDemo_hash)', function (data) {
            // layer.msg(JSON.stringify(data.field));
            table.reload('test', {
             where: {
                		"MemLoginId": "",
						"RealName": $("#memName").val(),
						"Mobile": $("#tel").val(),
						"RankGuid": $("#memLev option:selected").val(),
						"CircleName": $("#fenhui").val(),
						"Company": $("#gongsi").val(),
						"Brief": $("#yewu").val(),
						"SharedResource": $("#fenxiang").val(),
						"DemandResources": $("#gongqiu").val(),
						"AreaCode": areaCode,
						"TradeId": hangyeId
              }
            });
            return false;
          });
          
          
          
        }
      });
    });
    
//			table.on('checkbox(test)', function(obj){
////		  console.log("obj.checked",obj.checked); //当前是否选中状态
////		  console.log("obj.data",obj.data); //选中行的相关数据
////		  console.log("obj.type",obj.type); //如果触发的是全选，则为：all，如果触发的是单选，则为：one
//			console.log(obj.data)
//			if(obj.type=="one"){
//				if(obj.checked){
//					objArr.push(obj)
//					checkedArr.push(obj.data.Guid)
//					console.log(objArr)
//				}else if(!obj.checked){
//					objArr.splice(objArr.indexOf(obj.data),1)
//					checkedArr.splice(checkedArr.indexOf(obj.data.Guid),1)
//					console.log(objArr)
//				}
//			}
//		
//		});

table.on('checkbox(test)', function(obj){
			var checkStatus = table.checkStatus('test');
			let temp = [];
			let tempObj = [];
			checkStatus.data.forEach((el,index)=>{
				temp.push(el.Guid);
			})
			checkedArr = temp;
			console.log(temp)
		});
		
		function hoverOpenImg(){
			$('td img').hover(function(){
            //alert($(this).attr('src'));
            var img = "<img class='img_msg' src='"+$(this).attr('src')+"' style='width:130px;height:130px' />";
//          '<div><img src="{{ d.Images}}" style="width:25px;height:25px"></div>'
            img_show = layer.tips(img, this,{
                tips:[2, 'rgba(41,41,41,.5)']
                ,area: ['160px']
            });
        },function(){
            layer.close(img_show);
        });
		}
    
//  "#/layui/addFenhui?id="
    table.on('tool(test)',function(obj){
    	toolHandel("#/layui/ediMember?id=","Admin_Xn_Member/",obj,"","","#/layui/changeLev?id=");
    })
    
    
    
//  批量删除
//  batchDel.addEventListener("click",function(){
//  	batDel("Admin_Xn_Member/",checkedArr,objArr)
//  	
//  })
    
    batchDel.addEventListener("click",function(){
    	if(checkedArr.length!=0){
    		layer.confirm('确认删除？', function(index){
					layer.close(index);	
					console.log("checkedArr",checkedArr)
					DBHelper.Delete("Admin_Xn_Member",checkedArr,function(data){
				      	console.log(data)
				      },function(data){
				      	table.reload('test', {
								});
				      	console.log(data)
				      })
					
		    });
    	}else if(checkedArr.length==0){
			layer.alert("请选择至少一个选项")
		}
			
			
    })
    
//  续费
	addMoney.addEventListener("click",function(){
		if(checkedArr.length!=0){
    		layer.confirm('确认续费？', function(index){
					layer.close(index);	
					console.log("checkedArr",checkedArr)
					DBHelper.PostArr("UpdateXn_Member_ValidityDate",checkedArr,function(data){
				      	console.log(data)
				      	table.reload('test', {
								});
				      },function(data){
				      	
				      	console.log(data)
				      })
					
		    });
    	}else if(checkedArr.length==0){
			layer.alert("请选择至少一个选项")
		}
	})
    
//  推荐
    addTuiJian.addEventListener("click",function(){
    	if(checkedArr.length!=0){
    		layer.confirm('确认推荐？', function(index){
					layer.close(index);	
					console.log("checkedArr",checkedArr)
					DBHelper.PostArr("UpdateXn_Member_IsRecommendAdd",checkedArr,function(data){
				      	console.log(data,1)
				      	let ind = layer.alert('推荐成功',function(){
				      		layer.close(ind)
				      		table.reload('test', {
								});
				      	})
				      	
//				      	table.reload('test', {
//								});
				      },function(data){
				      	
				      	console.log(data)
				      })
					
		    });
    	}else if(checkedArr.length==0){
			layer.alert("请选择至少一个选项")
		}
			
			
    })
    
//  取消推荐
cancelTuiJian.addEventListener("click",function(){
    	if(checkedArr.length!=0){
    		layer.confirm('确认取消推荐？', function(index){
					layer.close(index);	
					console.log("checkedArr",checkedArr)
					DBHelper.PostArr("UpdateXn_Member_IsRecommendCancel",checkedArr,function(data){
				      	console.log(data,1)
				      	let ind = layer.alert('取消成功',function(){
				      		layer.close(ind)
				      		table.reload('test', {
								});
				      	})
				      	
//				      	table.reload('test', {
//								});
				      },function(data){
				      	
				      	console.log(data)
				      })
					
		    });
    	}else if(checkedArr.length==0){
			layer.alert("请选择至少一个选项")
		}
			
			
    })
    
	//  变更等级积分
	changeInte.addEventListener("click",function(data){
//		console.log("HI")
		if(checkedArr.length>1){
			layer.alert("请不要选择超过两个选项")
		}else if(checkedArr.length==1){
			window.location.href="#/layui/changeLev?id="+checkedArr[0];
		}else if(checkedArr.length==0){
			layer.alert("请选择一个选项")
		}
	})
	
//	check.addEventListener("click",function(){
//		if(checkedArr.length>1){
//			layer.alert("请不要选择超过两个选项")
//		}else if(checkedArr.length==1){
//		}
//	})
		
  });
  
  
    //强制刷新
//  var a = window.name
//  if(a == ''){
//  	window.name = "reloded"
//  	location.reload()
//  }else{
//  	window.name=""
//  }
</script>
<script type="text/javascript">
	let mlTable = document.querySelector("#memberListTable");
	console.log(mlTable);
	
</script>



<style scoped>
	.qxMaBtn{
		margin-bottom: 20px;
	}
		.qxMaInfo-table{
			font-size: 12px;
		}
		.qxMaInfo-table tr>th{
			text-align: center;
			font-size: 12px;
		}
		.qxMaInfo-table tr>td{
			text-align: center;
			font-size: 12px;
		}
      	.block{
      		display: block;
      	}
      	.qxMaTop-btn{
      		width: 100%;
      		text-align: center;
      	}
      	.qxMaInfo{
      		margin-top: 20px;
      		margin-bottom: 30px;
      	}
      	.qxMaTop-btn button{
      		display: inline-block;
      		width: 200px;
      		border-radius: 5px;
      	}
      	.title{
      		margin-left: 30px;
      		margin-top: 30px;
      	}
      	.save-warp{
      		width: 100%;
      		text-align: center;
      		margin-top: 20px;
      	}
      	.save-warp button{
      		display: inline-block;
      		width: 160px;
      	}
      	.qxMa-top{
      		display: flex;
      		justify-content: space-between;
      	}
      	.qxMa-table{
      		background-color: rgba(0,0,0,0);
      	}
      	
      	
      </style>

<script type="text/javascript">
//      1.创建对象
        var xhr = new XMLHttpRequest();
//      2.发送请求 open方法
        xhr.open("GET","https://xnsmb.xnsoft.net.cn/api/Admin_Xn_Member");//注册用什么方式，去哪里请求
//      3.将请求发送出去 send方法
        xhr.send();
//      4.处理数据
        xhr.addEventListener("readystatechange",function(e){
                if(e.target.readyState==4 && e.target.status==200 ){
                    console.log(e.target.response);
                    renderData(e.target.response);
                    console.log(JSON.parse(e.target.response));
                    
                }
            })
</script>



